//----------------------------------Include-------------------------------------
#include "mcu.h"
//------------------------------------------------------------------------------

//PY00--TDO     PY01--TDI    PY02--TCK    PY03--TMS    PY04--TRST
//PZ07--boot1   PZ06--boot0

//PZ00--PWR_ON      PZ01--RESETN    PZ02--PBUTN   PZ03--WBUTN   PZ04--PLED    PZ05--WLED
//PZ10--HIBERNATE   PZ11--STANDBY

//--------------------------------Public Func-----------------------------------
void mcu_init_do(void)
{
//periph clock
  
//output
  //PB29  --LED
  //PB30  --LED
  //PB31  --LED
  HPM_IOC->PAD[IOC_PAD_PB29].FUNC_CTL = IOC_PB29_FUNC_CTL_GPIO_B_29;
  HPM_IOC->PAD[IOC_PAD_PB30].FUNC_CTL = IOC_PB30_FUNC_CTL_GPIO_B_30;
  HPM_IOC->PAD[IOC_PAD_PB31].FUNC_CTL = IOC_PB31_FUNC_CTL_GPIO_B_31;

  //init and default output
  gpio_set_pin_output_with_initial(HPM_GPIO0,  GPIO_DO_GPIOB,  29,  1);   //1亮0灭
  gpio_set_pin_output_with_initial(HPM_GPIO0,  GPIO_DO_GPIOB,  30,  1);   //1亮0灭
  gpio_set_pin_output_with_initial(HPM_GPIO0,  GPIO_DO_GPIOB,  31,  1);   //1亮0灭
}

//LED
void mcu_led_toggle(void)
{
  gpio_toggle_pin(HPM_GPIO0, GPIO_DO_GPIOB, 29);
  gpio_toggle_pin(HPM_GPIO0, GPIO_DO_GPIOB, 30);
  gpio_toggle_pin(HPM_GPIO0, GPIO_DO_GPIOB, 31);
}
//------------------------------------EOF---------------------------------------



